<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>Git知识总结 | ShuangChenYue</title>
    <meta name="generator" content="VuePress 1.9.10">
    <link rel="icon" href="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg">
    <meta name="description" content="满招损，谦受益">
    <meta name="keywords" content="专注于Cpp语言的旅行者">
    
    <link rel="preload" href="/assets/css/0.styles.952d6952.css" as="style"><link rel="preload" href="/assets/js/app.67adcfd9.js" as="script"><link rel="preload" href="/assets/js/4.9aaa1650.js" as="script"><link rel="preload" href="/assets/js/1.5474518c.js" as="script"><link rel="preload" href="/assets/js/3.593d14fc.js" as="script"><link rel="preload" href="/assets/js/150.9bd8c175.js" as="script"><link rel="prefetch" href="/assets/js/10.3242746b.js"><link rel="prefetch" href="/assets/js/100.9224de43.js"><link rel="prefetch" href="/assets/js/101.f0d1b059.js"><link rel="prefetch" href="/assets/js/102.996bfc6d.js"><link rel="prefetch" href="/assets/js/103.9bfdbd6f.js"><link rel="prefetch" href="/assets/js/104.8613f283.js"><link rel="prefetch" href="/assets/js/105.aa6e809e.js"><link rel="prefetch" href="/assets/js/106.90192392.js"><link rel="prefetch" href="/assets/js/107.e82a40b7.js"><link rel="prefetch" href="/assets/js/108.994cd438.js"><link rel="prefetch" href="/assets/js/109.ec15acc2.js"><link rel="prefetch" href="/assets/js/11.c04b41c1.js"><link rel="prefetch" href="/assets/js/110.c32d8576.js"><link rel="prefetch" href="/assets/js/111.453b5d50.js"><link rel="prefetch" href="/assets/js/112.ffbdb3a4.js"><link rel="prefetch" href="/assets/js/113.12b8ad7d.js"><link rel="prefetch" href="/assets/js/114.899d2998.js"><link rel="prefetch" href="/assets/js/115.b7ad9576.js"><link rel="prefetch" href="/assets/js/116.a8394748.js"><link rel="prefetch" href="/assets/js/117.0edfe25b.js"><link rel="prefetch" href="/assets/js/118.9161b1fe.js"><link rel="prefetch" href="/assets/js/119.be59e21b.js"><link rel="prefetch" href="/assets/js/12.41437bf6.js"><link rel="prefetch" href="/assets/js/120.bcf439fb.js"><link rel="prefetch" href="/assets/js/121.c3d251b8.js"><link rel="prefetch" href="/assets/js/122.62b1caba.js"><link rel="prefetch" href="/assets/js/123.787c2ab0.js"><link rel="prefetch" href="/assets/js/124.a880746f.js"><link rel="prefetch" href="/assets/js/125.d8edfe7b.js"><link rel="prefetch" href="/assets/js/126.4ff01546.js"><link rel="prefetch" href="/assets/js/127.9416d1ff.js"><link rel="prefetch" href="/assets/js/128.01a4a7a0.js"><link rel="prefetch" href="/assets/js/129.76876665.js"><link rel="prefetch" href="/assets/js/13.922328e9.js"><link rel="prefetch" href="/assets/js/130.7f631dd9.js"><link rel="prefetch" href="/assets/js/131.c9e0fde9.js"><link rel="prefetch" href="/assets/js/132.1c04cde5.js"><link rel="prefetch" href="/assets/js/133.e8f381cd.js"><link rel="prefetch" href="/assets/js/134.03d19f8b.js"><link rel="prefetch" href="/assets/js/135.44607494.js"><link rel="prefetch" href="/assets/js/136.6a1eb3c9.js"><link rel="prefetch" href="/assets/js/137.27898fd1.js"><link rel="prefetch" href="/assets/js/138.5bc0cf54.js"><link rel="prefetch" href="/assets/js/139.c2d1addc.js"><link rel="prefetch" href="/assets/js/14.e54d7526.js"><link rel="prefetch" href="/assets/js/140.052ec8e4.js"><link rel="prefetch" href="/assets/js/141.131abb5a.js"><link rel="prefetch" href="/assets/js/142.6ba6c07b.js"><link rel="prefetch" href="/assets/js/143.5dd51d22.js"><link rel="prefetch" href="/assets/js/144.b45afca8.js"><link rel="prefetch" href="/assets/js/145.faa9fb04.js"><link rel="prefetch" href="/assets/js/146.b54c024d.js"><link rel="prefetch" href="/assets/js/147.a1223242.js"><link rel="prefetch" href="/assets/js/148.4767bcb2.js"><link rel="prefetch" href="/assets/js/149.b65ab046.js"><link rel="prefetch" href="/assets/js/15.7082a3da.js"><link rel="prefetch" href="/assets/js/151.9f830e96.js"><link rel="prefetch" href="/assets/js/152.41cde7f0.js"><link rel="prefetch" href="/assets/js/153.f57d65e0.js"><link rel="prefetch" href="/assets/js/154.5d7c8d51.js"><link rel="prefetch" href="/assets/js/155.0ae99532.js"><link rel="prefetch" href="/assets/js/156.5a54e043.js"><link rel="prefetch" href="/assets/js/157.c25b5d40.js"><link rel="prefetch" href="/assets/js/158.aa025b46.js"><link rel="prefetch" href="/assets/js/159.47939d88.js"><link rel="prefetch" href="/assets/js/16.fc775b7b.js"><link rel="prefetch" href="/assets/js/160.f8624459.js"><link rel="prefetch" href="/assets/js/161.7a075dc2.js"><link rel="prefetch" href="/assets/js/162.1d48f266.js"><link rel="prefetch" href="/assets/js/163.5d68a99f.js"><link rel="prefetch" href="/assets/js/164.1262d0e5.js"><link rel="prefetch" href="/assets/js/165.2ccf0bdd.js"><link rel="prefetch" href="/assets/js/166.21ece4d9.js"><link rel="prefetch" href="/assets/js/167.bf8adb95.js"><link rel="prefetch" href="/assets/js/168.1cb8440d.js"><link rel="prefetch" href="/assets/js/169.1dd1e396.js"><link rel="prefetch" href="/assets/js/17.ecc7be70.js"><link rel="prefetch" href="/assets/js/170.c29ec18f.js"><link rel="prefetch" href="/assets/js/171.38820827.js"><link rel="prefetch" href="/assets/js/172.bbc8ffc6.js"><link rel="prefetch" href="/assets/js/173.470e21e7.js"><link rel="prefetch" href="/assets/js/174.3c2df318.js"><link rel="prefetch" href="/assets/js/175.d2690cdb.js"><link rel="prefetch" href="/assets/js/176.9ca64696.js"><link rel="prefetch" href="/assets/js/177.76f3271d.js"><link rel="prefetch" href="/assets/js/178.d7d9def2.js"><link rel="prefetch" href="/assets/js/179.b5644743.js"><link rel="prefetch" href="/assets/js/18.31fe7ecd.js"><link rel="prefetch" href="/assets/js/180.7592d5ef.js"><link rel="prefetch" href="/assets/js/181.5cb77d35.js"><link rel="prefetch" href="/assets/js/182.6fa5633c.js"><link rel="prefetch" href="/assets/js/183.b3a53d1b.js"><link rel="prefetch" href="/assets/js/184.3815c537.js"><link rel="prefetch" href="/assets/js/185.bcf4ab71.js"><link rel="prefetch" href="/assets/js/186.1cc02f6d.js"><link rel="prefetch" href="/assets/js/187.8b425fb7.js"><link rel="prefetch" href="/assets/js/188.44ccbd02.js"><link rel="prefetch" href="/assets/js/189.353b35e3.js"><link rel="prefetch" href="/assets/js/19.520992d5.js"><link rel="prefetch" href="/assets/js/190.c284595f.js"><link rel="prefetch" href="/assets/js/191.788ecc2d.js"><link rel="prefetch" href="/assets/js/192.712a164e.js"><link rel="prefetch" href="/assets/js/193.da58aba3.js"><link rel="prefetch" href="/assets/js/194.6b1b1f4d.js"><link rel="prefetch" href="/assets/js/195.c31d5c39.js"><link rel="prefetch" href="/assets/js/196.f6670c4d.js"><link rel="prefetch" href="/assets/js/197.5a1f50ab.js"><link rel="prefetch" href="/assets/js/2.ab565158.js"><link rel="prefetch" href="/assets/js/20.69e29cdc.js"><link rel="prefetch" href="/assets/js/21.2fd424ad.js"><link rel="prefetch" href="/assets/js/22.d4c0be54.js"><link rel="prefetch" href="/assets/js/23.4bb90ecc.js"><link rel="prefetch" href="/assets/js/24.c01be6b2.js"><link rel="prefetch" href="/assets/js/25.c8833687.js"><link rel="prefetch" href="/assets/js/26.8042b555.js"><link rel="prefetch" href="/assets/js/27.0d5fa4c0.js"><link rel="prefetch" href="/assets/js/28.f9735b8b.js"><link rel="prefetch" href="/assets/js/29.3af53626.js"><link rel="prefetch" href="/assets/js/30.5f1b56d1.js"><link rel="prefetch" href="/assets/js/31.544b2649.js"><link rel="prefetch" href="/assets/js/32.aa321988.js"><link rel="prefetch" href="/assets/js/33.6aba2c86.js"><link rel="prefetch" href="/assets/js/34.e1bbff24.js"><link rel="prefetch" href="/assets/js/35.233f76e0.js"><link rel="prefetch" href="/assets/js/36.cb773972.js"><link rel="prefetch" href="/assets/js/37.393d9c59.js"><link rel="prefetch" href="/assets/js/38.e2d530c5.js"><link rel="prefetch" href="/assets/js/39.acaf1cc0.js"><link rel="prefetch" href="/assets/js/40.358f731e.js"><link rel="prefetch" href="/assets/js/41.ded24b7e.js"><link rel="prefetch" href="/assets/js/42.b9f683c3.js"><link rel="prefetch" href="/assets/js/43.c8fb3e66.js"><link rel="prefetch" href="/assets/js/44.633142da.js"><link rel="prefetch" href="/assets/js/45.6095e772.js"><link rel="prefetch" href="/assets/js/46.421d8c7a.js"><link rel="prefetch" href="/assets/js/47.da50fe47.js"><link rel="prefetch" href="/assets/js/48.15ff5726.js"><link rel="prefetch" href="/assets/js/49.b662e624.js"><link rel="prefetch" href="/assets/js/5.c1b8a209.js"><link rel="prefetch" href="/assets/js/50.a8bc75df.js"><link rel="prefetch" href="/assets/js/51.51e36ae7.js"><link rel="prefetch" href="/assets/js/52.54cc6e51.js"><link rel="prefetch" href="/assets/js/53.4173561d.js"><link rel="prefetch" href="/assets/js/54.7cab8416.js"><link rel="prefetch" href="/assets/js/55.3d7317d3.js"><link rel="prefetch" href="/assets/js/56.3c22255b.js"><link rel="prefetch" href="/assets/js/57.18e46e30.js"><link rel="prefetch" href="/assets/js/58.aad57f31.js"><link rel="prefetch" href="/assets/js/59.7897f6a7.js"><link rel="prefetch" href="/assets/js/6.3131f88a.js"><link rel="prefetch" href="/assets/js/60.5cd0051a.js"><link rel="prefetch" href="/assets/js/61.d9606403.js"><link rel="prefetch" href="/assets/js/62.aede9df0.js"><link rel="prefetch" href="/assets/js/63.2c30e554.js"><link rel="prefetch" href="/assets/js/64.18228ab7.js"><link rel="prefetch" href="/assets/js/65.27cb3fba.js"><link rel="prefetch" href="/assets/js/66.2fa6c2dc.js"><link rel="prefetch" href="/assets/js/67.d274a8df.js"><link rel="prefetch" href="/assets/js/68.3069cfcf.js"><link rel="prefetch" href="/assets/js/69.4c28600f.js"><link rel="prefetch" href="/assets/js/7.89e6165d.js"><link rel="prefetch" href="/assets/js/70.4175440c.js"><link rel="prefetch" href="/assets/js/71.2ee6b435.js"><link rel="prefetch" href="/assets/js/72.c75e3bb8.js"><link rel="prefetch" href="/assets/js/73.6f8b8211.js"><link rel="prefetch" href="/assets/js/74.6c7720cf.js"><link rel="prefetch" href="/assets/js/75.cccfb229.js"><link rel="prefetch" href="/assets/js/76.f022e5da.js"><link rel="prefetch" href="/assets/js/77.dab46206.js"><link rel="prefetch" href="/assets/js/78.ca574b2a.js"><link rel="prefetch" href="/assets/js/79.3d75e618.js"><link rel="prefetch" href="/assets/js/80.091749b1.js"><link rel="prefetch" href="/assets/js/81.14db0e21.js"><link rel="prefetch" href="/assets/js/82.8a2b1809.js"><link rel="prefetch" href="/assets/js/83.84a4b599.js"><link rel="prefetch" href="/assets/js/84.11d7c222.js"><link rel="prefetch" href="/assets/js/85.273d4388.js"><link rel="prefetch" href="/assets/js/86.fb40e20c.js"><link rel="prefetch" href="/assets/js/87.3316639e.js"><link rel="prefetch" href="/assets/js/88.dfc52200.js"><link rel="prefetch" href="/assets/js/89.8d615f6e.js"><link rel="prefetch" href="/assets/js/90.1d9f08bb.js"><link rel="prefetch" href="/assets/js/91.566813e7.js"><link rel="prefetch" href="/assets/js/92.d13c6f41.js"><link rel="prefetch" href="/assets/js/93.845c42a0.js"><link rel="prefetch" href="/assets/js/94.20a37b77.js"><link rel="prefetch" href="/assets/js/95.1a498005.js"><link rel="prefetch" href="/assets/js/96.39fa7f4b.js"><link rel="prefetch" href="/assets/js/97.50f7170e.js"><link rel="prefetch" href="/assets/js/98.dd2e15d6.js"><link rel="prefetch" href="/assets/js/99.ef7ea06a.js"><link rel="prefetch" href="/assets/js/vendors~docsearch.ae6b1de9.js">
    <link rel="stylesheet" href="/assets/css/0.styles.952d6952.css">
  </head>
  <body class="theme-mode-light">
    <div id="app" data-server-rendered="true"><div class="theme-container sidebar-open have-rightmenu"><header class="navbar blur"><div title="目录" class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><img src="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/logo/白云.38zbldnhh180.jpg" alt="ShuangChenYue" class="logo"> <span class="site-name can-hide">ShuangChenYue</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="嵌入式软件开发" class="dropdown-title"><!----> <span class="title" style="display:;">嵌入式软件开发</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d142c2/" class="nav-link">电子嵌入式通信协议</a></li><li class="dropdown-item"><!----> <a href="/pages/4c6bf3/" class="nav-link">深入浅出SSD</a></li><li class="dropdown-item"><!----> <a href="/pages/d3f36a/" class="nav-link">文件系统</a></li><li class="dropdown-item"><!----> <a href="/pages/e0cca7/" class="nav-link">汇编语言</a></li><li class="dropdown-item"><!----> <a href="/pages/fab2d7/" class="nav-link">STM32</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" aria-current="page" class="nav-link router-link-exact-active router-link-active">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/db6fb8/" class="nav-link">Git备忘清单</a></li><li class="dropdown-item"><!----> <a href="/pages/e1081f/" class="nav-link">Git 创建删除远程分支</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/1ab9a6/" class="nav-link">Shell 脚本学习笔记</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/907786/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/a2d21e/" class="nav-link">kylinV10-SP1 安装 QT</a></li><li class="dropdown-item"><!----> <a href="/pages/b561cf/" class="nav-link">高并发内存池</a></li><li class="dropdown-item"><!----> <a href="/pages/6ab6d1/" class="nav-link">USBGUARD 项目编译环境配置</a></li><li class="dropdown-item"><!----> <a href="/pages/883f02/" class="nav-link">Power_Destory 项目</a></li><li class="dropdown-item"><!----> <a href="/pages/479472/" class="nav-link">U 盘清除工具编译教程</a></li><li class="dropdown-item"><!----> <a href="/pages/9c4241/" class="nav-link">个人博客代码推送教程</a></li><li class="dropdown-item"><!----> <a href="/pages/3ad765/" class="nav-link">SVN Trunk Branches的Merge操作</a></li><li class="dropdown-item"><!----> <a href="/pages/0c0ca8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="MFC" class="dropdown-title"><!----> <span class="title" style="display:;">MFC</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/a4b108/" class="nav-link">MFC编程随记</a></li><li class="dropdown-item"><!----> <a href="/pages/41acbd/" class="nav-link">MFC实现ini配置文件的读取</a></li><li class="dropdown-item"><!----> <a href="/pages/951a7a/" class="nav-link">MFC实现点击列表头排序</a></li><li class="dropdown-item"><!----> <a href="/pages/a8598f/" class="nav-link">贴图法美化Button按钮</a></li><li class="dropdown-item"><!----> <a href="/pages/054516/" class="nav-link">MFC使用细节</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="闪存" class="dropdown-title"><!----> <span class="title" style="display:;">闪存</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/b925b8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li><li class="dropdown-item"><!----> <a href="/pages/28ec23/" class="nav-link">NAND Flash</a></li><li class="dropdown-item"><!----> <a href="/pages/62bf40/" class="nav-link">ARM 处理器</a></li><li class="dropdown-item"><!----> <a href="/pages/1a9374/" class="nav-link">嵌入式基础知识-存储器</a></li><li class="dropdown-item"><!----> <a href="/pages/aac5e3/" class="nav-link">闪存存储和制造技术概述</a></li><li class="dropdown-item"><!----> <a href="/pages/8f6056/" class="nav-link">芯片IO驱动力</a></li><li class="dropdown-item"><!----> <a href="/pages/d146b8/" class="nav-link">主流先进封装技术介绍</a></li><li class="dropdown-item"><!----> <a href="/pages/16f0ba/" class="nav-link">NAND Flash基础</a></li><li class="dropdown-item"><!----> <a href="/pages/90d8d0/" class="nav-link">基于PA算法的FTL引导</a></li><li class="dropdown-item"><!----> <a href="/pages/eb672b/" class="nav-link">SD逻辑擦除和物理擦除</a></li><li class="dropdown-item"><!----> <a href="/pages/747121/" class="nav-link">NAND Flash的SDR、ONFI、DDR接口</a></li><li class="dropdown-item"><!----> <a href="/pages/1eb351/" class="nav-link">【详解】Nand Flash必看知识</a></li><li class="dropdown-item"><!----> <a href="/pages/d2512a/" class="nav-link">【两万字详解】Nand Flash必看知识</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li><li class="dropdown-item"><!----> <a href="/pages/c7c01f/" class="nav-link">完美世界秋招 C++ 游戏开发面经(Cpp部分)</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <div class="sidebar-hover-trigger"></div> <aside class="sidebar" style="display:none;"><!----> <nav class="nav-links"><div class="nav-item"><a href="/" class="nav-link">首页</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="CPP语言" class="dropdown-title"><!----> <span class="title" style="display:;">CPP语言</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/c5bdd8/" class="nav-link">Cpp之旅</a></li><li class="dropdown-item"><!----> <a href="/pages/279e62/" class="nav-link">Cpp专栏</a></li><li class="dropdown-item"><!----> <a href="/pages/801755/" class="nav-link">Effective_CPP</a></li><li class="dropdown-item"><!----> <a href="/pages/6b2468/" class="nav-link">muduo网络库</a></li><li class="dropdown-item"><!----> <a href="/pages/5f8c9f/" class="nav-link">Unix环境高级编程</a></li><li class="dropdown-item"><!----> <a href="/pages/3f1d21/" class="nav-link">Cpp提高编程</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="计算机基础" class="dropdown-title"><!----> <span class="title" style="display:;">计算机基础</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/7b1cb2/" class="nav-link">计算机网络</a></li><li class="dropdown-item"><!----> <a href="/pages/6048a8/" class="nav-link">操作系统</a></li><li class="dropdown-item"><!----> <a href="/pages/3b34ba/" class="nav-link">数据结构</a></li><li class="dropdown-item"><!----> <a href="/pages/412fe7/" class="nav-link">Linux</a></li><li class="dropdown-item"><!----> <a href="/pages/2dcfa1/" class="nav-link">算法</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="数据库" class="dropdown-title"><!----> <span class="title" style="display:;">数据库</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/efa3f2/" class="nav-link">基础篇</a></li><li class="dropdown-item"><!----> <a href="/pages/ccc445/" class="nav-link">MySql</a></li><li class="dropdown-item"><!----> <a href="/pages/54616e/" class="nav-link">Redis</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="嵌入式软件开发" class="dropdown-title"><!----> <span class="title" style="display:;">嵌入式软件开发</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d142c2/" class="nav-link">电子嵌入式通信协议</a></li><li class="dropdown-item"><!----> <a href="/pages/4c6bf3/" class="nav-link">深入浅出SSD</a></li><li class="dropdown-item"><!----> <a href="/pages/d3f36a/" class="nav-link">文件系统</a></li><li class="dropdown-item"><!----> <a href="/pages/e0cca7/" class="nav-link">汇编语言</a></li><li class="dropdown-item"><!----> <a href="/pages/fab2d7/" class="nav-link">STM32</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="开发日常" class="dropdown-title"><!----> <span class="title" style="display:;">开发日常</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/e472d1/" class="nav-link">随笔（持续更新）</a></li><li class="dropdown-item"><!----> <a href="/pages/71f6ae/" aria-current="page" class="nav-link router-link-exact-active router-link-active">Git知识总结</a></li><li class="dropdown-item"><!----> <a href="/pages/db6fb8/" class="nav-link">Git备忘清单</a></li><li class="dropdown-item"><!----> <a href="/pages/e1081f/" class="nav-link">Git 创建删除远程分支</a></li><li class="dropdown-item"><!----> <a href="/pages/777b8a/" class="nav-link">nvm使用小结</a></li><li class="dropdown-item"><!----> <a href="/pages/ee770e/" class="nav-link">虚拟机固定 IP 地址</a></li><li class="dropdown-item"><!----> <a href="/pages/1ab9a6/" class="nav-link">Shell 脚本学习笔记</a></li><li class="dropdown-item"><!----> <a href="/pages/411aa4/" class="nav-link">VScode 插件 CodeGeeX 使用教程</a></li><li class="dropdown-item"><!----> <a href="/pages/0d525d/" class="nav-link">KylinV10 将项目上传至 Github教程</a></li><li class="dropdown-item"><!----> <a href="/pages/907786/" class="nav-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li class="dropdown-item"><!----> <a href="/pages/a2d21e/" class="nav-link">kylinV10-SP1 安装 QT</a></li><li class="dropdown-item"><!----> <a href="/pages/b561cf/" class="nav-link">高并发内存池</a></li><li class="dropdown-item"><!----> <a href="/pages/6ab6d1/" class="nav-link">USBGUARD 项目编译环境配置</a></li><li class="dropdown-item"><!----> <a href="/pages/883f02/" class="nav-link">Power_Destory 项目</a></li><li class="dropdown-item"><!----> <a href="/pages/479472/" class="nav-link">U 盘清除工具编译教程</a></li><li class="dropdown-item"><!----> <a href="/pages/9c4241/" class="nav-link">个人博客代码推送教程</a></li><li class="dropdown-item"><!----> <a href="/pages/3ad765/" class="nav-link">SVN Trunk Branches的Merge操作</a></li><li class="dropdown-item"><!----> <a href="/pages/0c0ca8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="前端学习" class="dropdown-title"><!----> <span class="title" style="display:;">前端学习</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/99897f/" class="nav-link">HTML与CSS</a></li><li class="dropdown-item"><!----> <a href="/pages/51542d/" class="nav-link">JS学习</a></li><li class="dropdown-item"><!----> <a href="/pages/803f9d/" class="nav-link">Vue3入门</a></li><li class="dropdown-item"><!----> <a href="/pages/ca4cfb/" class="nav-link">Vue3进阶</a></li><li class="dropdown-item"><!----> <a href="/pages/50e8d3/" class="nav-link">黑马Vue3</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="MFC" class="dropdown-title"><!----> <span class="title" style="display:;">MFC</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/a4b108/" class="nav-link">MFC编程随记</a></li><li class="dropdown-item"><!----> <a href="/pages/41acbd/" class="nav-link">MFC实现ini配置文件的读取</a></li><li class="dropdown-item"><!----> <a href="/pages/951a7a/" class="nav-link">MFC实现点击列表头排序</a></li><li class="dropdown-item"><!----> <a href="/pages/a8598f/" class="nav-link">贴图法美化Button按钮</a></li><li class="dropdown-item"><!----> <a href="/pages/054516/" class="nav-link">MFC使用细节</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="闪存" class="dropdown-title"><!----> <span class="title" style="display:;">闪存</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/b925b8/" class="nav-link">如何高效阅读嵌入式项目代码</a></li><li class="dropdown-item"><!----> <a href="/pages/28ec23/" class="nav-link">NAND Flash</a></li><li class="dropdown-item"><!----> <a href="/pages/62bf40/" class="nav-link">ARM 处理器</a></li><li class="dropdown-item"><!----> <a href="/pages/1a9374/" class="nav-link">嵌入式基础知识-存储器</a></li><li class="dropdown-item"><!----> <a href="/pages/aac5e3/" class="nav-link">闪存存储和制造技术概述</a></li><li class="dropdown-item"><!----> <a href="/pages/8f6056/" class="nav-link">芯片IO驱动力</a></li><li class="dropdown-item"><!----> <a href="/pages/d146b8/" class="nav-link">主流先进封装技术介绍</a></li><li class="dropdown-item"><!----> <a href="/pages/16f0ba/" class="nav-link">NAND Flash基础</a></li><li class="dropdown-item"><!----> <a href="/pages/90d8d0/" class="nav-link">基于PA算法的FTL引导</a></li><li class="dropdown-item"><!----> <a href="/pages/eb672b/" class="nav-link">SD逻辑擦除和物理擦除</a></li><li class="dropdown-item"><!----> <a href="/pages/747121/" class="nav-link">NAND Flash的SDR、ONFI、DDR接口</a></li><li class="dropdown-item"><!----> <a href="/pages/1eb351/" class="nav-link">【详解】Nand Flash必看知识</a></li><li class="dropdown-item"><!----> <a href="/pages/d2512a/" class="nav-link">【两万字详解】Nand Flash必看知识</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="面经" class="dropdown-title"><!----> <span class="title" style="display:;">面经</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/d69946/" class="nav-link">虎牙C++技术面经</a></li><li class="dropdown-item"><!----> <a href="/pages/29251d/" class="nav-link">金山一面复习</a></li><li class="dropdown-item"><!----> <a href="/pages/c7c01f/" class="nav-link">完美世界秋招 C++ 游戏开发面经(Cpp部分)</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="其它" class="dropdown-title"><!----> <span class="title" style="display:;">其它</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/pages/fa256e/" class="nav-link">博客搭建</a></li><li class="dropdown-item"><!----> <a href="/pages/335531/" class="nav-link">网站收藏箱</a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><a href="/pages/71f6ae/" aria-current="page" class="active sidebar-link">Git知识总结</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level2"><a href="/pages/71f6ae/#版本控制" class="sidebar-link">版本控制</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#什么是版本控制" class="sidebar-link">什么是版本控制？</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#为什么需要版本控制" class="sidebar-link">为什么需要版本控制？</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#三大版本控制系统" class="sidebar-link">三大版本控制系统</a></li><li class="sidebar-sub-header level4"><a href="/pages/71f6ae/#本地版本控制系统" class="sidebar-link">本地版本控制系统</a></li><li class="sidebar-sub-header level4"><a href="/pages/71f6ae/#集中化的版本控制系统" class="sidebar-link">集中化的版本控制系统</a></li><li class="sidebar-sub-header level4"><a href="/pages/71f6ae/#分布式版本控制系统" class="sidebar-link">分布式版本控制系统</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/71f6ae/#在开发中-常用的-git-开发操作流程是怎样的" class="sidebar-link">在开发中，常用的 git 开发操作流程是怎样的？</a></li><li class="sidebar-sub-header level2"><a href="/pages/71f6ae/#git-快速入门" class="sidebar-link">Git 快速入门</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#git-有哪三种状态" class="sidebar-link">Git 有哪三种状态？</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#git-关联-idea-文件颜色的意思" class="sidebar-link">Git 关联 idea 文件颜色的意思？</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#git-项目的三个工作区域" class="sidebar-link">Git 项目的三个工作区域</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#基本的-git-工作流程" class="sidebar-link">基本的 Git 工作流程</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#查看-git-版本号" class="sidebar-link">查看 Git 版本号</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#git的配置文件" class="sidebar-link">Git的配置文件</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#什么是-git-flow" class="sidebar-link">什么是 Git Flow</a></li><li class="sidebar-sub-header level3"><a href="/pages/71f6ae/#常用操作" class="sidebar-link">常用操作</a></li><li class="sidebar-sub-header level4"><a href="/pages/71f6ae/#获取-git-仓库" class="sidebar-link">获取 Git 仓库</a></li><li class="sidebar-sub-header level4"><a href="/pages/71f6ae/#添加和提交" class="sidebar-link">添加和提交</a></li><li class="sidebar-sub-header level4"><a href="/pages/71f6ae/#初始化一个-readme文件" class="sidebar-link">初始化一个 Readme文件</a></li><li class="sidebar-sub-header level4"><a href="/pages/71f6ae/#切换分支" class="sidebar-link">切换分支</a></li><li class="sidebar-sub-header level4"><a href="/pages/71f6ae/#推送" class="sidebar-link">推送</a></li></ul></li><li class="sidebar-sub-header level2"><a href="/pages/71f6ae/#idea-使用更新项目操作" class="sidebar-link">IDEA 使用更新项目操作</a></li><li class="sidebar-sub-header level2"><a href="/pages/71f6ae/#参考" class="sidebar-link">参考</a></li></ul></li><li><a href="/pages/777b8a/" class="sidebar-link">nvm使用小结</a></li><li><a href="/pages/e472d1/" class="sidebar-link">随笔（持续更新）</a></li><li><a href="/pages/ee770e/" class="sidebar-link">虚拟机固定ip地址</a></li><li><a href="/pages/411aa4/" class="sidebar-link">VScode 插件 CodeGeex 使用教程</a></li><li><a href="/pages/0d525d/" class="sidebar-link">KylinV10 将项目上传至 Github</a></li><li><a href="/pages/907786/" class="sidebar-link">KylinV10 安装 MySQL 教程（可防踩雷）</a></li><li><a href="/pages/9c4241/" class="sidebar-link">个人博客代码推送教程</a></li><li><a href="/pages/a2d21e/" class="sidebar-link">kylinV10-SP1 安装 QT</a></li><li><a href="/pages/b561cf/" class="sidebar-link">高并发内存池</a></li><li><a href="/pages/6ab6d1/" class="sidebar-link">USBGUARD项目编译环境配置</a></li><li><a href="/pages/1ab9a6/" class="sidebar-link">Shell 脚本学习笔记</a></li><li><a href="/pages/db6fb8/" class="sidebar-link">Git 备忘清单</a></li><li><a href="/pages/883f02/" class="sidebar-link">Power_Destory 项目</a></li><li><a href="/pages/479472/" class="sidebar-link">U盘清除工具编译教程</a></li><li><a href="/pages/e1081f/" class="sidebar-link">Git 创建删除远程分支</a></li><li><a href="/pages/3ad765/" class="sidebar-link">SVN Trunk Branches的Merge操作</a></li><li><a href="/pages/0c0ca8/" class="sidebar-link">如何高效阅读嵌入式项目代码</a></li></ul> </aside> <div><main class="page"><div class="theme-vdoing-wrapper "><div class="articleInfo-wrap" data-v-06225672><div class="articleInfo" data-v-06225672><ul class="breadcrumbs" data-v-06225672><li data-v-06225672><a href="/" title="首页" class="iconfont icon-home router-link-active" data-v-06225672></a></li> <li data-v-06225672><span data-v-06225672>开发日常</span></li></ul> <div class="info" data-v-06225672><div title="作者" class="author iconfont icon-touxiang" data-v-06225672><a href="javascript:;" data-v-06225672>霜晨月</a></div> <div title="创建时间" class="date iconfont icon-riqi" data-v-06225672><a href="javascript:;" data-v-06225672>2023-05-28</a></div> <!----></div></div></div> <!----> <div class="content-wrapper"><div class="right-menu-wrapper"><div class="right-menu-margin"><div class="right-menu-title">目录</div> <div class="right-menu-content"></div></div></div> <h1><img src="">Git知识总结<!----></h1> <!----> <div class="theme-vdoing-content content__default"><h1 id="git-知识总结"><a href="#git-知识总结" class="header-anchor">#</a> Git 知识总结</h1> <blockquote><p>命令学习：<a href="https://oschina.gitee.io/learn-git-branching/" target="_blank" rel="noopener noreferrer">Learn Git Branching<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <p>Git 命令大全：<a href="https://gitee.com/all-about-git" target="_blank" rel="noopener noreferrer">Git 大全<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></blockquote> <h2 id="版本控制"><a href="#版本控制" class="header-anchor">#</a> 版本控制</h2> <h3 id="什么是版本控制"><a href="#什么是版本控制" class="header-anchor">#</a> 什么是版本控制？</h3> <p>版本控制是一种记录一个或若干个文件内容变化，<strong>以便将来查阅特定版本修订情况</strong>的系统。关键时刻，可以回退版本。</p> <blockquote><p>除了项目源代码，你可以对任何类型的文件进行版本控制。</p></blockquote> <h3 id="为什么需要版本控制"><a href="#为什么需要版本控制" class="header-anchor">#</a> 为什么需要版本控制？</h3> <ul><li>版本控制可以让你将某个文件回溯到之前的状态，甚至将整个项目都回退到过去某个时间点的状态。</li> <li>你还可以通过提交的历史记录来比较文件的变化细节，查出最后是谁修改了哪个地方，从而找出导致怪异问题出现的原因，又是谁在何时报告了某个功能缺陷等等。</li></ul> <h3 id="三大版本控制系统"><a href="#三大版本控制系统" class="header-anchor">#</a> 三大版本控制系统</h3> <h4 id="本地版本控制系统"><a href="#本地版本控制系统" class="header-anchor">#</a> 本地版本控制系统</h4> <p>方便个人管理项目文件。</p> <p>大多都是采用某种简单的数据库来记录文件的历次更新差异。</p> <h4 id="集中化的版本控制系统"><a href="#集中化的版本控制系统" class="header-anchor">#</a> 集中化的版本控制系统</h4> <p>为解决开发者协同合作问题而生。</p> <p>都有一个<strong>单一的集中管理的服务器</strong>，可以保存所有文件的修订版本，协同工作的开发者们都可以通过客户端连到这台服务器，取出最新的文件或者提交更新。</p> <p><strong>有两个问题：</strong></p> <ol><li><strong>单点故障：</strong> 中央服务器宕机，则其他人无法使用；如果中心数据库磁盘损坏又没有进行备份，你将丢失所有数据。本地版本控制系统也存在类似问题，只要整个项目的历史记录被保存在单一位置，就有丢失所有历史更新记录的风险。</li> <li>**必须联网才能工作：**受网络状况和网络带宽影响。</li></ol> <h4 id="分布式版本控制系统"><a href="#分布式版本控制系统" class="header-anchor">#</a> 分布式版本控制系统</h4> <p>为解决上面的问题面世，比如：Git</p> <p><strong>有以下几个优点：</strong></p> <ol><li>这类系统，客户端并不只提取最新版本的文件快照，而是把代码仓库完整地克隆下来。这么一来，任何一处协同工作用的服务器发生故障，事后都可以用任何一个克隆出来的本地仓库恢复。因为每一次的克隆操作，实际上都是一次对代码仓库的完整备份。</li> <li>可以不用联网工作，因为每个人的电脑上都是完整的版本库。</li> <li>强大的分支管理功能。</li></ol> <h2 id="在开发中-常用的-git-开发操作流程是怎样的"><a href="#在开发中-常用的-git-开发操作流程是怎样的" class="header-anchor">#</a> 在开发中，常用的 git 开发操作流程是怎样的？</h2> <p>在使用 Git 进行开发时，常用的操作流程包括：</p> <ol><li><p>创建 Git 仓库：使用 <code>git init</code> 命令初始化一个新的 Git 仓库。也可以使用 <code>git clone</code> 命令克隆一个远程仓库到本地。</p></li> <li><p>添加文件到暂存区：使用 <code>git add</code> 命令将修改的文件添加到 Git 的暂存区中。</p></li> <li><p>提交修改：使用 <code>git commit</code> 命令提交修改。可以使用 <code>-m</code> 参数指定提交的注释信息。</p></li> <li><p>分支操作：使用 <code>git branch</code> 命令创建、删除、查看分支。使用 <code>git checkout</code> 命令切换分支。</p></li> <li><p>合并分支：使用 <code>git merge</code> 命令将一个分支合并到当前分支。</p></li> <li><p>推送修改：使用 <code>git push</code> 命令将本地修改推送到远程仓库。</p></li> <li><p>拉取修改：使用 <code>git pull</code> 命令从远程仓库拉取最新修改。</p></li> <li><p>查看修改历史：使用 <code>git log</code> 命令查看提交历史。</p></li> <li><p>撤销修改：使用 <code>git reset</code> 命令撤销某次提交。可以使用 <code>--soft</code> 参数保留修改到暂存区，使用 <code>--mixed</code> 参数保留修改到工作区，使用 <code>--hard</code> 参数彻底删除修改。</p></li> <li><p>标签操作：使用 <code>git tag</code> 命令创建、删除、查看标签。标签可以用于标记某个版本，便于后续查找和发布。</p></li></ol> <h2 id="git-快速入门"><a href="#git-快速入门" class="header-anchor">#</a> Git 快速入门</h2> <h3 id="git-有哪三种状态"><a href="#git-有哪三种状态" class="header-anchor">#</a> Git 有哪三种状态？</h3> <ol><li><strong>已提交（committed）</strong>：数据已经安全的保存在本地数据库中。</li> <li><strong>已修改（modified）</strong>：已修改表示修改了文件，但还没保存到数据库中。</li> <li><strong>已暂存（staged）</strong>：表示对一个已修改文件的当前版本做了标记，使之包含在下次提交的快照中。</li></ol> <h3 id="git-关联-idea-文件颜色的意思"><a href="#git-关联-idea-文件颜色的意思" class="header-anchor">#</a> Git 关联 idea 文件颜色的意思？</h3> <ol><li>红色（red），<strong>未加入</strong>版本控制</li> <li>绿色（green），已经加入版本控制暂<strong>未提交</strong></li> <li>蓝色（blue），加入版本控制，已提交，<strong>有改动</strong></li> <li>白色（white），加入版本控制，已提交，<strong>无改动</strong></li> <li>灰色（grey）：版本控制<strong>已忽略</strong>文件</li></ol> <h3 id="git-项目的三个工作区域"><a href="#git-项目的三个工作区域" class="header-anchor">#</a> Git 项目的三个工作区域</h3> <ol><li>工作目录(working)</li> <li>暂存区域(index)</li> <li>Git 仓库(HEAD)</li></ol> <p>working <code>=add=&gt;</code> index <code>=commit=&gt;</code> HEAD <code>=push=&gt;</code> 远程仓库</p> <p><img alt="image" data-src="https://cdn.jsdelivr.net/gh/cmty256/imgs-blog@main/images/image.y5jbgb7v2e8.jpg" loading="lazy" class="lazy"></p> <h3 id="基本的-git-工作流程"><a href="#基本的-git-工作流程" class="header-anchor">#</a> 基本的 Git 工作流程</h3> <ol><li><strong>准备仓库</strong>：创建或从服务端克隆一个仓库。</li> <li><strong>搬砖</strong>：在工作目录中添加、修改代码。</li> <li><strong>暂存</strong>（git add）：将需要进行版本管理的文件放入暂存区域。</li> <li><strong>提交</strong>（git commit）：将暂存区域的文件提交到Git仓库。</li> <li><strong>推送</strong>（git push）：将本地仓库推送到远程仓库，同步版本库。</li> <li><strong>获取更新</strong>（fetch/pull）：从服务端更新到本地，获取他人推送的更新，与他人协作、共享</li></ol> <ul><li><p>在工作目录中<strong>修改文件</strong>。 -- 即写代码</p></li> <li><p><strong>暂存文件</strong>，将文件的快照放入暂存区域。 -- 即表示已修改，文件变蓝色</p></li> <li><p><strong>提交更新</strong>，找到暂存区域的文件，将快照永久性存储到 Git 仓库目录中。</p></li></ul> <blockquote><p>文件的快照：就是指 文件的数据。是 Git 版本控制的核心。</p></blockquote> <h3 id="查看-git-版本号"><a href="#查看-git-版本号" class="header-anchor">#</a> 查看 Git 版本号</h3> <p>指令：<code>git -- version</code></p> <h3 id="git的配置文件"><a href="#git的配置文件" class="header-anchor">#</a> Git的配置文件</h3> <p>Git有三个主要的配置文件：</p> <p>三个配置文件的优先级是 <strong>① &lt; ② &lt; ③</strong></p> <p><strong>① 系统全局配置</strong>(--system)：包含了适用于系统所有用户和所有仓库（项目）的配置信息，<strong>存放在 Git 安装目录下：</strong><code>C:\Program Files\Git\etc\gitconfig</code></p> <p><strong>② 用户全局配置</strong>(--global)：当前系统用户的全局配置，<strong>存放用户目录：</strong><code>C:\Users\[系统用户名]\.gitconfig</code>。</p> <p><strong>③ 仓库/项目配置</strong>(--local)：仓库（项目）的特定配置，<strong>存放在项目目录下：</strong><code>.git/config</code></p> <div class="language-yml line-numbers-mode"><pre class="language-yml"><code><span class="token comment">#查看git配置</span>
git config <span class="token punctuation">-</span><span class="token punctuation">-</span>list
git config <span class="token punctuation">-</span>l
 
<span class="token comment">#查看系统配置</span>
git config <span class="token punctuation">-</span><span class="token punctuation">-</span>system <span class="token punctuation">-</span><span class="token punctuation">-</span>list
 
<span class="token comment">#查看当前用户（global）全局配置</span>
git config <span class="token punctuation">-</span><span class="token punctuation">-</span>list <span class="token punctuation">-</span><span class="token punctuation">-</span>global
 
<span class="token comment">#查看当前仓库配置信息</span>
git config <span class="token punctuation">-</span><span class="token punctuation">-</span>local  <span class="token punctuation">-</span><span class="token punctuation">-</span>list
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br></div></div><h3 id="什么是-git-flow"><a href="#什么是-git-flow" class="header-anchor">#</a> 什么是 Git Flow</h3> <p>Git Flow 是一种基于 Git 版本控制工具的<strong>分支管理</strong>工作流程，它定义了一套完整的分支模型，包括主分支、开发分支、功能分支、修复分支等，旨在优化团队协作、版本发布和代码质量等方面的工作流程。</p> <h3 id="常用操作"><a href="#常用操作" class="header-anchor">#</a> 常用操作</h3> <h4 id="获取-git-仓库"><a href="#获取-git-仓库" class="header-anchor">#</a> 获取 Git 仓库</h4> <p>有两种方法：</p> <ol><li><p><strong>在当前项目目录中初始化仓库：</strong></p> <p>右键点击 <code>Git Bash Here</code> 进入窗口运行 <code>git init</code> 命令，该命令将创建一个名为 <code>.git</code> 的子目录，代表已经加入版本控制。</p></li> <li><p><strong>从一个服务器（远程仓库）克隆一个现有的 Git 仓库：</strong></p> <p>进入希望项目存放的目录地址，运行 <code>git clone [url] 自定义文件夹名称</code> 命令。</p> <p><strong>注意</strong>，使用<code>Git</code>命令克隆的方式可以和 原项目 随时保持更新同步。</p></li> <li><p>克隆本地仓库</p> <p><code>git clone /path/to/repository</code></p></li></ol> <h4 id="添加和提交"><a href="#添加和提交" class="header-anchor">#</a> 添加和提交</h4> <p>添加、删除、改名：</p> <div class="language-yml line-numbers-mode"><pre class="language-yml"><code><span class="token comment"># 添加指定文件到暂存区，包括被修改的文件</span>
$ git add <span class="token punctuation">[</span>file1<span class="token punctuation">]</span> <span class="token punctuation">[</span>file2<span class="token punctuation">]</span> <span class="token punctuation">...</span>
 
<span class="token comment"># 添加当前目录的所有文件到暂存区</span>
$ git add .
 
<span class="token comment"># 删除工作区文件，并且将这次删除放入暂存区</span>
$ git rm <span class="token punctuation">[</span>file1<span class="token punctuation">]</span> <span class="token punctuation">[</span>file2<span class="token punctuation">]</span> <span class="token punctuation">...</span>
 
<span class="token comment"># 改名文件，并且将这个改名放入暂存区</span>
$ git mv <span class="token punctuation">[</span>file<span class="token punctuation">-</span>original<span class="token punctuation">]</span> <span class="token punctuation">[</span>file<span class="token punctuation">-</span>renamed<span class="token punctuation">]</span>
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br></div></div><p>提交：</p> <ul><li><code>git commit -m &quot;代码提交信息&quot;</code>  -- 此时已提交到了本地仓库中</li></ul> <h4 id="初始化一个-readme文件"><a href="#初始化一个-readme文件" class="header-anchor">#</a> 初始化一个 Readme文件</h4> <div class="language- line-numbers-mode"><pre class="language-text"><code>touch README.md
</code></pre> <div class="line-numbers-wrapper"><span class="line-number">1</span><br></div></div><h4 id="切换分支"><a href="#切换分支" class="header-anchor">#</a> 切换分支</h4> <p><code>git checkout &lt;branch&gt;</code></p> <h4 id="推送"><a href="#推送" class="header-anchor">#</a> 推送</h4> <ul><li><p>查看本地 Git 仓库已经关联的远程仓库：<code>git remote -v</code></p></li> <li><p>关联远程仓库：<code>git remote add origin &lt;server&gt;</code></p></li> <li><p>推送分支：<code>git push origin master[分支名称]</code></p></li></ul> <blockquote><p><code>origin</code> 是远程仓库的名称，<code>&lt;server&gt;</code> 是远程仓库的 URL。</p></blockquote> <h2 id="idea-使用更新项目操作"><a href="#idea-使用更新项目操作" class="header-anchor">#</a> IDEA 使用更新项目操作</h2> <p>在使用 IntelliJ IDEA 进行 Git 操作时，更新项目时会出现如下两个选项：</p> <ol><li><code>Update Project</code> 使用的是普通合并（merge）的方式，<strong>它会将远程分支上的最新代码拉取到本地，然后将本地分支上的代码与远程分支上的代码合并</strong>。如果有冲突，需要手动解决冲突并提交代码。这种方式会生成一个新的合并提交，保留了本地分支和远程分支的所有提交历史。</li> <li><code>Update Project with Rebase</code> 使用的是变基（rebase）的方式，<strong>它会将本地分支上的所有提交临时保存，然后将远程分支上的最新代码拉取到本地，并用变基的方式将本地分支上的所有提交重新基于远程分支的最新提交</strong>。如果有冲突，需要手动解决冲突并提交代码。这种方式会生成一系列新的提交，覆盖了本地分支的所有提交历史。</li></ol> <p>需要注意的是，使用变基操作会改变提交历史，可能会影响其他人的开发分支。因此，在多人协作开发中，<strong>建议使用普通合并（merge）操作</strong>，只在特定情况下使用变基操作，例如在开发分支上进行调整和整理提交历史。</p> <p>在选择更新方式时，可以根据实际情况选择合适的选项。如果当前分支与远程分支的差异较小，可以使用普通合并；如果差异较大，或者需要整理提交历史，可以使用变基操作。无论选择哪种方式，都需要谨慎处理未提交的修改，以免造成代码冲突和数据丢失。</p> <h2 id="参考"><a href="#参考" class="header-anchor">#</a> 参考</h2> <p>git - 简明指南：<a href="https://rogerdudler.github.io/git-guide/index.zh.html" target="_blank" rel="noopener noreferrer">git - the simple guide - no deep shit! (rogerdudler.github.io)<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p></div></div> <!----> <div class="page-edit"><!----> <!----> <div class="last-updated"><span class="prefix">上次更新:</span> <span class="time">2024/6/3 14:54:44</span></div></div> <div class="page-nav-wapper"><div class="page-nav-centre-wrap"><!----> <a href="/pages/777b8a/" class="page-nav-centre page-nav-centre-next"><div class="tooltip">nvm使用小结</div></a></div> <div class="page-nav"><p class="inner"><!----> <span class="next"><a href="/pages/777b8a/">nvm使用小结</a>→
      </span></p></div></div></div> <!----></main></div> <div class="footer"><!----> 
  Theme by
  <a href="https://github.com/xugaoyi/vuepress-theme-vdoing" target="_blank" title="本站主题">Vdoing</a> 
    | Copyright © 2023-2025
    <span>霜晨月</span></div> <div class="buttons"><div title="返回顶部" class="button blur go-to-top iconfont icon-fanhuidingbu" style="display:none;"></div> <div title="去评论" class="button blur go-to-comment iconfont icon-pinglun" style="display:none;"></div> <div title="主题模式" class="button blur theme-mode-but iconfont icon-zhuti"><ul class="select-box" style="display:none;"><li class="iconfont icon-zidong">
          跟随系统
        </li><li class="iconfont icon-rijianmoshi">
          浅色模式
        </li><li class="iconfont icon-yejianmoshi">
          深色模式
        </li><li class="iconfont icon-yuedu">
          阅读模式
        </li></ul></div></div> <!----> <!----> <!----></div><div class="global-ui"><canvas id="vuepress-canvas-cursor"></canvas></div></div>
    <script src="/assets/js/app.67adcfd9.js" defer></script><script src="/assets/js/4.9aaa1650.js" defer></script><script src="/assets/js/1.5474518c.js" defer></script><script src="/assets/js/3.593d14fc.js" defer></script><script src="/assets/js/150.9bd8c175.js" defer></script>
  </body>
</html>
